package com.gsoc.spreadsheet.client;

import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.ScrollPanel;

public class Aggregate {

	private CellGrid[][] grids;
	private Grid table;
	private ScrollPanel display;
	
	public Aggregate() {
		int size = 3;
		grids = new CellGrid[size][size];
		
		table = new Grid(size, size);
		table.setCellPadding(0);
		table.setCellSpacing(0);
		
		for(int r = 0; r < size; ++r) {
			for(int c = 0; c < size; ++c) {
				grids[r][c] = new CellGrid();
				table.setWidget(r, c, grids[r][c].view());
			}
 		}
		
		display = new ScrollPanel(display);
		display.setAlwaysShowScrollBars(true);
	}
	
	public Aggregate(int size) {
		grids = new CellGrid[size][size];
		
		table = new Grid(size, size);
		table.setCellPadding(0);
		table.setCellSpacing(0);
		
		for(int r = 0; r < size; ++r) {
			for(int c = 0; c < size; ++c) {
				grids[r][c] = new CellGrid();
				table.setWidget(r, c, grids[r][c].view());
			}
 		}
		
		display = new ScrollPanel(display);
		display.setAlwaysShowScrollBars(true);
	}
	
	public ScrollPanel view() {
		return display;
	}
	
	public void loadRow(int shift) {
		
	}
	
	public void loadCol(int shift) {
		
	}
}
